/****** Object:  StoredProcedure [dbo].[spChiTietBienBanKiemKeKhoGetByMaKy]    Script Date: 10/13/2012 22:19:10 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spChiTietBienBanKiemKeKhoGetByMaKy]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[spChiTietBienBanKiemKeKhoGetByMaKy]
GO

/****** Object:  StoredProcedure [dbo].[spChiTietBienBanKiemKeKhoGetByMaKy]    Script Date: 10/13/2012 22:19:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[spChiTietBienBanKiemKeKhoGetByMaKy]
	@maky as nvarchar(8)
WITH ENCRYPTION
AS
	SELECT ct.MaKy, sp.MaThuoc, sp.TenHoatChat, sp.TenBietDuoc, lk.SoLo, lk.HanSuDung, ct.SoCuoiKy as TonSoSach, ct.SoCuoiKy as TonThucTe, lk.MaLuuKho
	FROM tbl_SanPham sp
	INNER JOIN tbl_LuuKho lk ON sp.MaThuoc = lk.MaThuoc
	INNER JOIN tbl_ChiTietDongMoKy ct ON ct.MaLuuKho = lk.MaLuuKho
	WHERE ct.MaKy = @maky

GO


